package com.linkstec.szkettle;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.linkstec.util.HttpClientHelper;


public class HttpKettleRunTest {
	private static final Logger logger = LogManager.getLogger();

	public void execute(String transName) {
		
		String kettle = "http://192.168.10.141:8085";
		//获取kettle的URL
		String urltemp = kettle + "/kettle/runTrans/?trans=/";
		//目标URL    Transformation name
		String urltemp1 = transName; 
		
		//获取响应
		String result = HttpClientHelper.httpGet(urltemp + urltemp1);
		logger.error(urltemp + urltemp1);
		if("".equals(result)||result==null) {
			logger.error("启动转换失败，请确认!");
		}
        //解析响应
//        JSONObject jo = JSONObject.fromObject(result);
//        JSONArray ja = JSONArray.fromObject(jo.get("topologies"));
//        Iterator<?> iter = ja.iterator();
            
		
//		SlaveServerConfig slaveServerConfig = new SlaveServerConfig();
//		slaveServerConfig.setPasswordFile(passwordFile)
		
		
	}

	public static void main(String[] args) {
		new HttpKettleRunTest().execute("insert_update");
	}
}
